#! /bin/php

<?php 
function GetTwoFilesContentsMd5($file1,$file2)
{
	$contents_string = '';
	$handle = fopen($file1, 'r');
	$contents_string = fread($handle,filesize($file1));	
	fclose($handle);

	$handle = fopen($file2, 'r');
	$contents_string .= fread($handle,filesize($file2));	
	fclose($handle);
	
	$md5 = md5($contents_string);
	return $md5;
}

function WriteStringToFile($file, $string)
{

	$handle = fopen($file, "w+");
	if (fwrite ($handle, $string) == FALSE)
	{
		print "Write file error!";
	}
	fclose($handle);
}

$Upgrade_patch_tar_gz = 'patch.tar.gz';
$Upgrade_exec = 'exec.sh';
$Upgrade_ini = 'config.ini';

$string = GetTwoFilesContentsMd5($Upgrade_patch_tar_gz, $Upgrade_exec);
WriteStringToFile($Upgrade_ini, $string);

?>
